<template>
  <div>
    <div>
      使用action请求数据，修改state
    </div>
    <div>count:{{count}}</div>
    <div>hasChange:{{hasChange}}</div>
    <div>user:{{user}}</div>
    username:<input type="text" v-model="usernameRef">
    password:<input type="text" v-model="pwdRef">
    <button @click="handleGetGoods">获取用户信息</button>
    <div>用户信息：{{user}}</div>
  </div>
</template>
<script setup lang="ts">
import {useCounterStore,IUser} from '@/stores/counter'
import {storeToRefs} from 'pinia'
import {ref} from 'vue'
const counterStore = useCounterStore()
const {count,user,hasChange} = storeToRefs(counterStore)
const usernameRef = ref<string>('')
const pwdRef = ref<string>('')
// const userInfoRef = ref<IUser>()
async function handleGetGoods(){
  await counterStore.getUserInfoByRegister(usernameRef.value,pwdRef.value)
}
</script>